/*
 * @copyright fxsen <br/>
 * @date 2022/3/30 15:51 <br/>
 * @email <a href="mailto:fxsen@foxmail.com">
 * @author fxsen
 */
package com.fxsen.commons.web.core.config;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;

import java.util.List;

/**
 * @author fxsen
 * @date 2022/3/30 15:51
 * @email <a href="mailto:fxsen@foxmail.com">
 */
public class DefineMethodConfig extends DefaultSqlInjector {
    public DefineMethodConfig() {
    }

    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
        List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
        methodList.add(new InsertBatchSomeColumn((i) -> {
            return i.getFieldFill() != FieldFill.UPDATE;
        }));
        return methodList;
    }
}
